package com.cwt_taxi_xa;

import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.view.LayoutInflater;

import com.cwt_taxi_xa.custom_view.SwipeBackLayout;

/**
 * 想要实现向右滑动删除Activity效果只需要继承SwipeBackActivity即可，如果当前页面含有ViewPager
 * 只需要调用SwipeBackLayout的setViewPager()方法即可
 *
 * @author xiaanming
 *
 */
public class SwipeBackActivity extends FragmentActivity{
	protected SwipeBackLayout layout;
	private boolean openState = true;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		if(openState){
			layout = (SwipeBackLayout) LayoutInflater.from(this).inflate(
					R.layout.base, null);
			layout.attachToActivity(this);
		}
	}

	/*@Override
	public void startActivity(Intent intent) {
		super.startActivity(intent);
		overridePendingTransition(R.anim.base_slide_right_in, R.anim.base_slide_remain);
	}*/

	// Press the back button in mobile phone
	/*@Override
	public void onBackPressed() {
		super.onBackPressed();
		overridePendingTransition(0, R.anim.base_slide_right_out);
	}*/

	public void openSwipeBack(boolean openState) {
		// TODO Auto-generated method stub
		this.openState = openState;
	}
}
